// 引入系统模块
let http = require('http')

// 创建服务器,绑定请求对象和响应对象, 返回服务器对象
// console.log(http);
let server = http.createServer((request, response) => {
  // console.log(request);
  console.log(request.url);
  console.log(request.method);
  console.log(request.headers);





  //设置响应内容为页面
  response.writeHead(200, "okok", {
    "Content-Type": "text/html; charset=utf-8"
  })

  response.write("<h1>你好世界</h1>")
  response.end();//发送给浏览器结束
})
// 设置监听端口号
server.listen(8080, () => {
  console.log('服务器启动成功, 端口号为8080');

})

